-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flake8-type-checking
] Avoid false positives for |
in TC008
#15201
base: main
Are you sure you want to change the base?
[flake8-type-checking
] Avoid false positives for |
in TC008
#15201
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
TC008 | 2 | 0 | 2 | 0 | 0 |
This comment was marked as resolved.
This comment was marked as resolved.
c5ad656
to
89d35c2
Compare
@MichaReiser @AlexWaygood You should be able to review this now |
The ecosystem results make sense to me now. Since airflow targets Python 3.9+ mypy would flag those type aliases if they were unquoted. So a TC008 shouldn't trigger, despite there being no runtime effects. |
I've got some false positives that seem to be this, in combination with being in a Should I open an issue for this? |
@dangotbanned Yes, that's this bug, it can also be hit in different contexts, it just previously wasn't as likely to be hit in Feel free to open an issue, if you think it makes it easier for others to discover that this issue is known and will be fixed. |
All good, thanks for clarifying @Daverball 🙂 |
This is a follow-up to #15180
Summary
|
is not a valid runtime operation between types pre Python 3.10, so we should avoid unquoting the type expression.Additionally most type checkers don't care about the execution context, so while they will allow
|
between types in stub files for convenience, they will still disallow it in type checking blocks, since those are treated as regular runtime code.Test Plan
cargo nextest run